<cfscript>    
    view = createObject("component", session.rootDir & ".views.layout");
    if( Session.Auth EQ True and (Session.strAuthType EQ Session.MANAGERS or Session.strAuthType EQ Session.IT or Session.strAuthType EQ Session.HR or Session.Manager) ){
		view.init("Step 1: Manager - Initiate Hire",
			"/jquery/ui-1.8.5/jquery-ui.min.js,/jquery/plugins/scrollTo/jquery.scrollTo-1.4.2-min.js, /" & session.rootDir & "/static/js/SCF/Step1-Hire.js",
			"/jquery/ui-1.8.5/themes/cupertino/jquery-ui.css","Home",index);
    }else{
        view.init("Denied","","","Home","Denied");
    }    
    view.html();
</cfscript>

<cffunction name="index" access="public" output="true" returntype="any">

    <cfscript>
        import models.*;
        FormAction = '../controller/SubmitHandler.cfm?SCFStep1=add';
        KronosQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.Kronos");
        AccessControlQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.AccessControl");
        JustinsJobProg = CreateObject("component", session.rootDir & ".DatabaseQueries.JustinsJobProg");
        GetContainer = EntityLoad("ADContainer");
        GetLunch = EntityLoad("Lunch");
        GetDepts = KronosQueries.funcGetDepts();
        GetSupDept = KronosQueries.funcGetSupDept(Session.HRID);
        GetAccess = AccessControlQueries.funcGetAccess();
        GetStates = KronosQueries.funcGetStates();
        GetPhoneTypes = KronosQueries.funcGetPhoneTypes();
        GetJobPostings = JustinsJobProg.funcGetJobPostings();
    </cfscript>
    
    <cfoutput> 
    <h1 class="title">Step 1:  Manager - Initiate Hire</h1>
        <div class="entry">    
            Welcome, #Session.EmpInfo.FirstName# #Session.EmpInfo.LastName#.  
            In this step, we'll capture information necessary to initiate the hiring process. 
            Please provide the following information: <br /><br /> 

            <div class="notes">
                <table>
                    <tr>
                        <td valign="top">
                            NOTE:&nbsp;&nbsp;
                        </td>
                        <td>
                            This page is for SCF employees only.  
                            To process Non-SCF employees or individual contractors click <a href="non-scf/Step1-Request.cfm">here</a>.
                        </td>
                    </tr>
                </table>
            </div>            
            
            <cfform name="frmStep1" method="post" action="#FormAction#">
                <table class="main">
                    <tr>
                        <td>First, MI, Last:</td>
                        <td>
                            <cfinput type="text" name="FirstName" error_message="Please provide a first name."  tabindex="5" >                                
                            <cfinput type="text" name="MiddleName" size=1 maxlength="2" required="no" tabindex="7" >                                                        
                            <cfinput type="text" name="LastName" error_message="Please provide a last name." tabindex="10" >
                        </td>
                    </tr>
                    <tr>
                        <td>Preferred (First) Name:</td>
                        <td>
                            <cfinput type="text" name="PreferredName" tabindex="20" tooltip="Would appear in the Address Book and be used to create their network account." />
                        </td>
                    </tr>
                    <tr>
                        <TD nowrap=nowrap valign='top'>Phones:</TD>
                        <TD colspan=3>
                            <fieldset style='border:inset'>
                                <table>
                                    <TR>
                                        <td width =10>&nbsp;</td>
                                        <TD nowrap=nowrap>Primary Phone: </TD>
                                        <TD colspan=3>
                                            <cfselect name="PhonePrimaryID"  value="TypeCodeIdNo" display="TypeCode" query="GetPhoneTypes" tabindex="21" />
                                        </TD>
                                    </TR>  
                                    <tr>
                                        <td width =10>&nbsp;</td>
                                        <td nowrap=nowrap>Home Phone:</td>
                                        <td>
                                            <cfinput type='text' name='HomePhone' maxlength='14' error_message="The valid home phone format is xxx-xxx-xxxx." tabindex="22" >
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width =10>&nbsp;</td>
                                        <td nowrap=nowrap>Cell Phone:</td>
                                        <td>
                                            <cfinput type='text' name='CellPhone' maxlength='14' error_message='The valid cell phone format is xxx-xxx-xxxx.' tabindex="23" >
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width =10>&nbsp;</td>
                                        <td nowrap=nowrap>Work Phone:</td>
                                        <td>
                                            <cfinput type='text' name='WorkPhone' maxlength='14' error_message='The valid work phone format is xxx-xxx-xxxx.' tabindex="24" > x
                                            <cfinput type='text' name='WorkPhoneExtention' maxlength='6' error_message='Work Phone Extension (if provided) must be numeric.' size='7' tabindex="25" >
                                        </td>
                                    </tr>
                                </table>
                            </fieldset>
                        </TD>
                    </TR>
                    <tr>                    
                        <td>Contact Email:</td>
                        <td>
                            <cfinput type="text" name="Email" maxlength="50" tabindex="28" tooltip="From the employee's application" error_message="Please provide the contact Email that appears on the employees application." style="width:98%">
                        </td>
                    </tr>
                    <tr>
                        <td>Contact Address 1:</td>
                        <td colspan="3">
                            <cfinput type="text" name="Address1" tabindex="30" tooltip="From the employee's application" error_message="Please provide the contact address Line that appears on the employees application." style="width:98%" >
                        </td>
                    </tr>
                    <tr>
                        <td nowrap="nowrap">Contact Address 2:</td>
                        <td colspan="3">
                            <cfinput type="text" name="Address2" tabindex="40" required="no" tooltip="From the employee's application" style="width:98%" >
                        </td>
                    </tr>
                    <tr>
                        <td>City, State, ZIP:</td>
                        <td colspan="3">
                            <cfinput type="text" name="City" tabindex="41" tooltip="From the employee's application" error_message="Please provide the contact address City that appears on the employees application." style="width:50%" >                                
                            <cfselect name="State" tabindex="42"  value="LocalCodeIdNo" display="LocalCodeAbbreviation" query="GetStates"  Selected ="6" />
                            <cfinput type="text" name="ZIP" tabindex="43" tooltip="From the employee's application" error_message="Please provide the contact address ZIP that appears on the employees application." size='14' maxlength="10" >
                        </td>
                    </tr>
                    <tr>
                        <td>Position to Hire:</td>
                        <td colspan=3>
                            <cfselect name="PostingID" tabindex="50" style="width:98%">                            
                                 <cfloop query="GetJobPostings">
                                    <cfif len(JobTitle) GT 45>
                                        <cfset JobTitle = "(" & Bulletin & ") " & left(JobTitle, 45) & " ... ">
                                    <cfelse>
                                        <cfset JobTitle = "(" & Bulletin & ") " & JobTitle >
                                    </cfif>
                                    <option value="#ID#" <cfif ID EQ 0>Selected = selected</cfif>>#JobTitle#</option>
                                </cfloop> 
                                <option value="-1">Other (Please Provide Comments)</option>
                            </cfselect>                           
                        </td>
                    </tr>
                    <TR>
                        <TD>Department:</TD>
                        <TD colspan=3>
                            <cfselect name="DepartmentID" tabindex="60"  value="OrgCodeIDNo" display="Org" query="GetDepts"  />
                        </TD>
                    </TR>
                    <TR>
                        <TD valign="top">Comments:</TD>
                        <TD colspan=3>
                            <cftextarea rows="2" tabindex="65" name="Comments" style="width:98%" />
                        </TD>
                    </TR>
                    <tr>
                        <td colspan="4">
                            <fieldset>
                            <legend><strong>If Hired:</strong></legend>
                            <table>
                                <tr>
                                    <td valign="top" colspan="5">Please provide the following information to be used by the specified departments. </td>
                                </tr>
                                <tr>
                                    <td valign="top">
                                        <BR />
                                        <strong><u>Facilities</u></strong>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top">Badge Level Access:</td>
                                    <td colspan=4>
                                        <cfselect name="BadgeAccessLevelID" tabindex="70"  multiple="yes">
                                            <option value="0">-- None --</option>
                                             <cfloop query="GetAccess">
                                                <option value="#AccessLvID#">#Descript#</option>
                                            </cfloop> 
                                        </cfselect>  
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top">
                                        <BR />
                                        <BR />
                                        <strong>
                                            <u>Finance</u>
                                        </strong>
                                    </td>
                                </tr>
                                <tr>
                                    <td nowrap="nowrap">List of Time Card Approvers:</td>
                                    <td colspan=4>
                                        <cfinput type="text" name="TimeCardAppr" tabindex="80" tooltip="List of Time Card Approvers (for Finance/Kronos)" style="width:98%" >
                                    </td>
                                </tr>
                                <tr>
                                    <td nowrap="nowrap">Default Cost Code:</td>
                                    <td colspan=4>
                                        <cfinput type="text" name="CostCode" tabindex="85" error_message="Please Provide the default Cost Code" style="width:98%" maxlength="50">
                                    </td>
                                </tr>
                                <TR>
                                    <TD>Lunch:</TD>
                                    <TD><!---ORM not a database query--->
                                        <cfselect name="LunchID" tabindex="90" >
                                            <cfloop from="1" to="#ArrayLen(GetLunch)#" index="i">
                                            <option value="#GetLunch[i].getLunchID()#">#GetLunch[i].getLunchType()#</option>
                                            </cfloop>
                                        </cfselect>
                                    </TD>
                                </TR>
                                <TR>
                                    <TD valign="top">Eligibilty:</TD>
                                    <TD>
                                        <cfinput type="checkbox" name="Benefits" checked="no" tabindex="100"/> Benefits<BR/>
                                        <cfinput type="checkbox" name="Leave" checked="no" tabindex="110"/>Leave Accrual
                                    </TD>
                                </TR>
                                <tr>
                                    <td valign="top" colspan="3" nowrap="nowrap">
                                        <BR />
                                        <BR />
                                        <strong><u>Information Technology Services (ITS)</u></strong>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Phone Ext:</td>
                                    <td>
                                        <cfinput type="text" name="DeskPhone" maxlength="6" tabindex="130" tooltip="If a phone already exists at the employees work station, what is the 4 digit extension?" error_message="Must be numeric" />
                                    </td>
                                </tr>
                                <TR>
                                    <TD>Location/Container:</TD>
                                    <TD>
                                        <cfselect name="ContainerID" tabindex="140" selected="7" >
                                            <cfloop from="1" to="#ArrayLen(GetContainer)#" index="i">
                                                <option value="#GetContainer[i].getADContainerID()#" <cfif GetContainer[i].getADContainerID() EQ 7>selected=selected </cfif>>#GetContainer[i].getContainer()#</option>
                                            </cfloop>
                                        </cfselect>
                                    </TD>
                                </TR>
                            </table>
                            </fieldset>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5" align="right">
                            <cfinput type="button" name="Submit" value="Next >>" tabindex="150">
                            <cfinput type="hidden" name="FormAction" value="#FormAction#">
                        </td>
                    </tr>
                </table>
            </cfform>            
        </div>    
    </cfoutput>
    
</cffunction>